package com.app.java.io;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * I/O流的经典使用方式：缓冲文件输出.
 * @author User
 *
 */
public class BufferedOutputFile {
	public static void write(String fileName,String text) throws IOException{
		PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(fileName)));
		pw.print(text);
		pw.flush();
	}

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		String text = BufferedInputFile.read("readme.txt");
		BufferedOutputFile.write("out.txt",text);
	}

}
